package com.dyh.quickdemo.Spy;

import java.util.concurrent.ConcurrentHashMap;

/*
@Author=Joey Wheeler
@Date=2021/4/13 17:33
*/
public class SpyHeadquarters {

    private final static ConcurrentHashMap<String,Spy> spys = new ConcurrentHashMap<>();
//    private final static Map<String,Spy> spys = new HashMap<>();

     public static void watch(String target,Spy spy){
         spys.putIfAbsent(target,spy);
     }

    public static Spy  get(String target){
        return spys.get(target);
    }

     public static void withdraw(String target){
         spys.remove(target);
     }
}
